package utils

import (
	"fmt"
	"math/rand"
	"strings"
)

type FilePath struct {
	Filepath string
	Savepath string
	FileDir  string
	Mkdir    string
	Err      error
}

func GetAvatarSource(avatar string) string {
	if "" == avatar {
		return "/file/uploadfile/2016-8/17/picture.jpg"
	}
	return strings.Replace(avatar, "-cropper", "", -1)
}

func GetAvatar(avatar string) string {
	if "" == avatar {
		return fmt.Sprintf("/static/img/avatar/%d.jpg", rand.Intn(5))
	}
	return avatar
}
